-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Case sensitive file extensions #6500
Case sensitive file extensions #6500
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @llogiq (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
0eae294
to
07a9204
Compare
The Clippy Test check error seem to be unrelated to this change. Seems to be already fixed by matthiaskrgr/rust-clippy@2218dd6 |
☔ The latest upstream changes (presumably #6538) made this pull request unmergeable. Please resolve the merge conflicts. |
Can you do a rebase, not merge? We follow a rustc no-merge policy. |
0b92c6e
to
a6828fc
Compare
Sure! Sorry, it is my first contribution and I missed this. |
ping from triage @llogiq. This is awaiting your review. |
☔ The latest upstream changes (presumably #6542) made this pull request unmergeable. Please resolve the merge conflicts. |
Closes rust-lang#6425 Looks for ends_with methods calls with case sensitive extensions.
This was left as default and caused a CI failure for the case_sensitive_file_extension_comparison lint.
a6828fc
to
e56973a
Compare
I like this lint in general. It may benefit from adding a suggestion, as the replacement code in the docs is probably not obvious to the layman. However, we can still do that in a later PR. I still have to check if the docs and messages follow our conventions, will do that later. |
|
||
fn check_case_sensitive_file_extension_comparison(ctx: &LateContext<'_>, expr: &Expr<'_>) -> Option<Span> { | ||
lazy_static! { | ||
static ref RE: Regex = Regex::new(r"^\.([a-z0-9]{1,5}|[A-Z0-9]{1,5})$").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex is a fairly heavy dependency for this fairly simple check.
Ok, we already use @bors r+ |
📌 Commit e56973a has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
No lazy static regex r? `@llogiq` #6500 regex is unnecessary for this lint (#6500 (comment)) lazy_static is unnecessary. The std lazy feature should be used instead. changelog: none
Closes #6425
Looks for ends_with methods calls with case sensitive extension comparisons.
changelog: Add new lint that warns about case-sensitive file extension comparisons.